package com.ruoyi.video.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.video.mapper.VideoTemplateMapper;
import com.ruoyi.video.domain.VideoTemplate;
import com.ruoyi.video.service.IVideoTemplateService;
import com.ruoyi.common.core.text.Convert;

/**
 * 模板Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-07
 */
@Service
public class VideoTemplateServiceImpl implements IVideoTemplateService 
{
    @Autowired
    private VideoTemplateMapper videoTemplateMapper;

    /**
     * 查询模板
     * 
     * @param id 模板主键
     * @return 模板
     */
    @Override
    public VideoTemplate selectVideoTemplateById(Integer id)
    {
        return videoTemplateMapper.selectVideoTemplateById(id);
    }

    /**
     * 查询模板列表
     * 
     * @param videoTemplate 模板
     * @return 模板
     */
    @Override
    public List<VideoTemplate> selectVideoTemplateList(VideoTemplate videoTemplate)
    {
        return videoTemplateMapper.selectVideoTemplateList(videoTemplate);
    }

    /**
     * 新增模板
     * 
     * @param videoTemplate 模板
     * @return 结果
     */
    @Override
    public int insertVideoTemplate(VideoTemplate videoTemplate)
    {
        videoTemplate.setCreateTime(DateUtils.getNowDate());
        return videoTemplateMapper.insertVideoTemplate(videoTemplate);
    }

    /**
     * 修改模板
     * 
     * @param videoTemplate 模板
     * @return 结果
     */
    @Override
    public int updateVideoTemplate(VideoTemplate videoTemplate)
    {
        videoTemplate.setUpdateTime(DateUtils.getNowDate());
        return videoTemplateMapper.updateVideoTemplate(videoTemplate);
    }

    /**
     * 批量删除模板
     * 
     * @param ids 需要删除的模板主键
     * @return 结果
     */
    @Override
    public int deleteVideoTemplateByIds(String ids)
    {
        return videoTemplateMapper.deleteVideoTemplateByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除模板信息
     * 
     * @param id 模板主键
     * @return 结果
     */
    @Override
    public int deleteVideoTemplateById(Integer id)
    {
        return videoTemplateMapper.deleteVideoTemplateById(id);
    }
}
